const Joi = require('joi');


// 定义验证规则属性
const name = Joi.string().min(1).max(8).required();
const alias = Joi.string().alphanum().required();
const id = Joi.number().integer().min(0).required();
const artcate_schema = {
    /**
     * string() 值必须是字符串
     * alphanum() 值只能是包含 a-zA-Z0-9 的字符串
     * min(length) 最小长度
     * max(length) 最大长度
     * required() 值是必填项，不能为 undefined
     * pattern(正则表达式) 值必须符合正则表达式的规则
     */
    body: {
        name,
        alias
    }
}
const deleteCateById_schema = {
    params: {
        id,
    }
}
const getCateById_schema = {
    params: {
        id,
    }
}
const updateCateById_schema = {
    body: {
        Id: id,
        name,
        alias
    }
}


module.exports = {
    artcate_schema,
    deleteCateById_schema,
    getCateById_schema,
    updateCateById_schema
}